import request from '@/utils/request'

export function add(data) {
  return request({
    url: 'system/users',
    method: 'post',
    data
  })
}

export function del(id) {
  return request({
    url: 'system/users/' + id,
    method: 'delete'
  })
}

export function edit(data) {
  return request({
    url: 'system/users',
    method: 'put',
    data
  })
}

export function validPass(password) {
  const data = {
    password
  }
  return request({
    url: 'system/users/validPass/',
    method: 'POST',
    data
  })
}

export function updatePass(data) {
  // const data = {
  //   password
  // }
  return request({
    url: 'system/users/updatePass/',
    method: 'put',
    data
  })
}

export function updateEmail(code, data) {
  return request({
    url: 'system/users/updateEmail/' + code,
    method: 'post',
    data
  })
}

export function updateAvtar(data) {
  return request({
    url: 'system/users/updateAvatarApi',
    method: 'put',
    data
  })
}

export function enabled(data) {
  return request({
    url: 'system/users/updateEnabled',
    method: 'put',
    data
  })
}

export function exportExcel(params) {
  return request({
    url: 'system/users/exportUser',
    method: 'post',
    responseType: 'blob',
    params
  })
}

